DecSoft Analytics app plugin

This app plugin for DecSoft App Builder provide some useful JavaScript methods to integrate Google Analytics v4 in your app. This plugin is based in the fantastic GA4MP Javascript library.

Methods

app.plugins.decsoft.analytics.start()

This method can be called from the app DomReady event, for example. This method is intended to initialize the Google Analytics JavaScript library.

This method admits the below arguments:

Name Type Description
trackingId String The tracking ID of the Google Analytics v4 account to be used. Read more here about the tracking ID.

app.plugins.decsoft.analytics.sendView()

Once you starts the Google Analytics JavaScript library by calling app.plugins.decsoft.analytics.start(), you can use this method, for example, in an app view Show event or app dialog Show event, in order to send to the right Google Analytics account the information that the user as viewed that app view or app dialog.

What this method do is to send an event to Google Analytics named "screen_view" with an argument named "view_name" with the app view or dialog name.

app.plugins.decsoft.analytics.sendEvent()

Once you starts the Google Analytics JavaScript library by calling app.plugins.decsoft.analytics.start(), you can use this method in order to send to Google Analytics a custom event.

This method admits the below arguments:

Name Type Description
eventName String The event name that you want to send to Google Analytics.
eventArgs Object An optinal object variable with the arguments of the event that you want to send to Google Analytics.